<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@ include file="../include/head.jsp" %>
<%@ include file="../include/top.jsp" %>
<%@ include file="../include/left.jsp" %>
<div class="main-content">

    <%@ include file="../include/navigate.jsp" %>
    
    <div class="container">
        <div class="widget-box">
            <div class="widget-box-header">
                <div class="col-sm-2">
                    <div class="title"><i class="icon-edit">&nbsp;</i>修改参数</div>
                </div>
            </div>
            <div class="widget-box-content" style="padding:15px;">
                <c:if test="${param.error != null }">
                    <div id="loginError" class="alert alert-danger alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        <strong>异常</strong> ${param.error}
                    </div>
                </c:if>
                <form class="form-horizontal" role="form" action="${pageContext.request.contextPath}/parameter/updateParam" method="post" onsubmit="return check()">
                    <input type="hidden" name="id" value="${paramId}"/>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">参数名称：</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" name="gParamName" placeholder="参数名称" data-toggle="tooltip" id="groupName"
                                   data-placement="left" value="${paramName }" oninput="validate(this)" onclick="validate(this)" required>
                        </div>
                        <div class="col-sm-2 control-label" id="layerName_tips" style="text-align:left;color:#D16E6C;" hidden="true" >组名称不能为空!</div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">参数类型：</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" name="gParamType" placeholder="参数类型" data-toggle="tooltip" id="groupName"
                                   data-placement="left" value="${paramType}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">参数值：</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" name="gParamValue" placeholder="参数值" data-toggle="tooltip" id="groupName"
                                   data-placement="left" value="${paramValue}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">所属组别：</label>
                        <div class="col-sm-5">
                            <select id="selectGroup" class="form-control" name="group.id">
                            	<option value="">请选择...</option>
                            	<c:forEach items="${groupList}" var="group">
                            		<option value="${group.id }">${group.name}</option>
                            	</c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注：</label>
                        <div class="col-sm-5">
                        	<textarea name="gParamRemark" class="autosize-transition form-control" style="overflow: hidden; word-wrap: break-word; resize: vertical;">${paramRemark}</textarea>
                        </div>
                        
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>

                        <div class="col-sm-2">
                            <button type="submit" class="btn btn-success">提交</button>
                            <a type="button" class="btn btn-primary"
                               href="${pageContext.request.contextPath}/parameter/pList">
                                返回列表
                            </a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div style="position:fixed;bottom:0px; width:100%;" align="center">
        <%@ include file="../include/footer.jsp" %>
    </div>
</div>

<script type="text/javascript">
function test(o) {
	console.log(o);
}


function validate(button){
	if($(button).val().length < 1){
		$('#layerName_tips').prop("hidden", false);
		return false;
	} else {
		$('#layerName_tips').prop("hidden", true);
		return true;
	}
}

function check(){
	if(!$('#sequence').inputmask("isComplete")){
		$('#sequence_tips').prop("hidden", false);
		return false;
	}
	
	return validate($('#layerName'));
}
</script>

<%@ include file="../include/bottom.jsp" %>